package model

import (
	"time"

	"github.com/uptrace/bun"
)

type HUid struct {
	bun.BaseModel `bun:"table:huid"`
	Hid           int       `bun:"hid,pk,autoincrement"`
	Minv          int       `bun:"minv,notnull"`
	Off           int       `bun:"offset,notnull"`
	Maxv          int       `bun:"maxv,notnull"`
	Ctime         time.Time `bun:"ctime,default:current_timestamp"`
	Mtime         time.Time `bun:"mtime,default:current_timestamp"`
}

type HOpenUser struct {
	bun.BaseModel `bun:"table:hopen_user"`
	Hid           uint64    `bun:"hid,pk,autoincrement"`
	Oid           string    `bun:"oid,notnull"`
	Uid           uint64    `bun:"uid,notnull"`
	Otype         string    `bun:"otype,notnull"`
	Ctime         time.Time `bun:"ctime,default:current_timestamp"`
	Mtime         time.Time `bun:"mtime,default:current_timestamp"`
}

type HUser struct {
	bun.BaseModel `bun:"table:huser"`
	Hid           uint64    `bun:"hid,pk,autoincrement"`
	Uid           uint64    `bun:"uid,notnull"`
	Nickname      string    `bun:"nickname,notnull"`
	Avatar        string    `bun:"avatar,notnull"`
	Ctime         time.Time `bun:"ctime,default:current_timestamp"`
	Mtime         time.Time `bun:"mtime,default:current_timestamp"`
}

type HMoment struct {
	bun.BaseModel `bun:"table:hmoment"`
	Hid           uint64    `bun:"hid,pk,autoincrement"`
	Uid           uint64    `bun:"uid,notnull"`
	Score         int       `bun:"score,notnull"`
	Loves         int       `bun:"loves,notnull"`
	Views         int       `bun:"views,notnull"`
	Mid           string    `bun:"mid,notnull"`
	Title         string    `bun:"title,notnull"`
	Tag           string    `bun:"tag,notnull"`
	Author        string    `bun:"author,notnull"`
	Img           string    `bun:"img,notnull"`
	Location      string    `bun:"location,notnull"`
	Ctime         time.Time `bun:"ctime,default:current_timestamp"`
	Mtime         time.Time `bun:"mtime,default:current_timestamp"`
	Expire        time.Time `bun:"expire,default:current_timestamp"`
}

type HNotice struct {
	bun.BaseModel `bun:"table:hnotice"`
	Hid           uint64    `bun:"hid,pk,autoincrement"`
	Uid           uint64    `bun:"uid,notnull"`
	Score         int       `bun:"score,notnull"`
	Loves         int       `bun:"loves,notnull"`
	Views         int       `bun:"views,notnull"`
	Mid           string    `bun:"mid,notnull"`
	Title         string    `bun:"title,notnull"`
	Tag           string    `bun:"tag,notnull"`
	Author        string    `bun:"author,notnull"`
	Img           string    `bun:"img,notnull"`
	Content       string    `bun:"content,notnull"`
	Location      string    `bun:"location,notnull"`
	Ctime         time.Time `bun:"ctime,default:current_timestamp"`
	Mtime         time.Time `bun:"mtime,default:current_timestamp"`
	Expire        time.Time `bun:"expire,default:current_timestamp"`
}
